from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from queuepool import Pool

from app.config import MYSQL_IP, MYSQL_PORT, MYSQL_DATABASE, MYSQL_USERNAME, MYSQL_PASSWORD

engine = create_engine("mysql+pymysql://{}:{}@{}:{}/{}".format(MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_IP, MYSQL_PORT, MYSQL_DATABASE),echo=True,
                        poolclass=Pool,
                        pool_size=5,
                        pool_timeout=30,
                        pool_recycle=3600)
Session = sessionmaker(engine)

__all__ = [Session]
